home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Biblos_-_C2065885152007.psc / Biblos PSC / biblos.sql
Text File  |  2006-10-18  |  9KB  |  349 lines

  1. # SQL Manager 2005 for MySQL 3.7.0.1
  2. # ---------------------------------------
  3. # Host     : localhost
  4. # Port     : 3306
  5. # Database : biblos
  6.  
  7.  
  8. SET FOREIGN_KEY_CHECKS=0;
  9.  
  10. DROP DATABASE IF EXISTS `biblos`;
  11.  
  12. CREATE DATABASE `biblos`
  13.     CHARACTER SET 'latin1'
  14.     COLLATE 'latin1_swedish_ci';
  15.  
  16. #
  17. # Structure for the `campos` table : 
  18. #
  19.  
  20. DROP TABLE IF EXISTS `campos`;
  21.  
  22. CREATE TABLE `campos` (
  23.   `id_campo` int(11) NOT NULL auto_increment,
  24.   `id_tabla` int(11) NOT NULL,
  25.   `nombre` varchar(20) default NULL,
  26.   `tipo_datos` varchar(20) default NULL,
  27.   `fecha_creacion` date default NULL,
  28.   PRIMARY KEY  (`id_campo`,`id_tabla`)
  29. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  30.  
  31. #
  32. # Structure for the `categorias` table : 
  33. #
  34.  
  35. DROP TABLE IF EXISTS `categorias`;
  36.  
  37. CREATE TABLE `categorias` (
  38.   `id_categoria` int(11) NOT NULL auto_increment,
  39.   `descripcion` varchar(200) default NULL,
  40.   `fecha_alta` date default NULL,
  41.   PRIMARY KEY  (`id_categoria`),
  42.   CONSTRAINT `categorias_fk` FOREIGN KEY (`id_categoria`) REFERENCES `categorias` (`id_categoria`)
  43. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  44.  
  45. #
  46. # Structure for the `categorias_subcategorias` table : 
  47. #
  48.  
  49. DROP TABLE IF EXISTS `categorias_subcategorias`;
  50.  
  51. CREATE TABLE `categorias_subcategorias` (
  52.   `id_categoria` int(11) NOT NULL,
  53.   `id_subcategoria` int(11) NOT NULL,
  54.   PRIMARY KEY  (`id_categoria`,`id_subcategoria`)
  55. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  56.  
  57. #
  58. # Structure for the `editoriales` table : 
  59. #
  60.  
  61. DROP TABLE IF EXISTS `editoriales`;
  62.  
  63. CREATE TABLE `editoriales` (
  64.   `id_editorial` int(11) NOT NULL auto_increment,
  65.   `nombre` varchar(255) default NULL,
  66.   `tel_1` varchar(16) default NULL,
  67.   `tel_2` varchar(16) default NULL,
  68.   `email` varchar(100) default NULL,
  69.   `web` varchar(100) default NULL,
  70.   `domicilio_calle` varchar(255) default NULL,
  71.   `domicilio_piso` varchar(10) default NULL,
  72.   `domicilio_nro` varchar(10) default NULL,
  73.   `domicilio_cod_postal` varchar(12) default NULL,
  74.   `fecha_alta` date default NULL,
  75.   `fecha_baja` date default NULL,
  76.   PRIMARY KEY  (`id_editorial`)
  77. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  78.  
  79. #
  80. # Structure for the `fichas` table : 
  81. #
  82.  
  83. DROP TABLE IF EXISTS `fichas`;
  84.  
  85. CREATE TABLE `fichas` (
  86.   `id_ficha` int(11) NOT NULL auto_increment,
  87.   `id_usuario` int(11) NOT NULL,
  88.   `titulo` varchar(100) default NULL,
  89.   PRIMARY KEY  (`id_ficha`)
  90. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  91.  
  92. #
  93. # Structure for the `funcion_tabla_permiso` table : 
  94. #
  95.  
  96. DROP TABLE IF EXISTS `funcion_tabla_permiso`;
  97.  
  98. CREATE TABLE `funcion_tabla_permiso` (
  99.   `id_funcion` int(11) NOT NULL,
  100.   `id_tabla` int(11) NOT NULL,
  101.   `id_permiso` int(11) NOT NULL,
  102.   `fecha_creacion` date default NULL,
  103.   PRIMARY KEY  (`id_funcion`,`id_tabla`,`id_permiso`)
  104. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  105.  
  106. #
  107. # Structure for the `funciones` table : 
  108. #
  109.  
  110. DROP TABLE IF EXISTS `funciones`;
  111.  
  112. CREATE TABLE `funciones` (
  113.   `id_funcion` int(11) NOT NULL auto_increment,
  114.   `nombre` varchar(100) default NULL,
  115.   `fecha_creacion` date default NULL,
  116.   PRIMARY KEY  (`id_funcion`)
  117. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  118.  
  119. #
  120. # Structure for the `libros` table : 
  121. #
  122.  
  123. DROP TABLE IF EXISTS `libros`;
  124.  
  125. CREATE TABLE `libros` (
  126.   `id_libro` int(11) NOT NULL auto_increment,
  127.   `codigo_libro` varchar(30) default NULL,
  128.   `titulo` varchar(255) default NULL,
  129.   `autor` varchar(255) default NULL,
  130.   `ISBN` varchar(20) default NULL,
  131.   `anio` char(4) default NULL,
  132.   `fecha_alta` date default NULL,
  133.   `id_editorial` int(11) default NULL,
  134.   `id_ubicacion` int(11) default NULL,
  135.   `id_tipo_material` int(11) default NULL,
  136.   `fecha_baja` date default NULL,
  137.   PRIMARY KEY  (`id_libro`)
  138. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  139.  
  140. #
  141. # Structure for the `libros_categorias_subcategorias` table : 
  142. #
  143.  
  144. DROP TABLE IF EXISTS `libros_categorias_subcategorias`;
  145.  
  146. CREATE TABLE `libros_categorias_subcategorias` (
  147.   `id_categoria` int(11) NOT NULL,
  148.   `id_subcategoria` int(11) NOT NULL,
  149.   `id_libro` int(11) NOT NULL,
  150.   `fecha_creacion` date default NULL,
  151.   PRIMARY KEY  (`id_categoria`,`id_subcategoria`,`id_libro`)
  152. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  153.  
  154. #
  155. # Structure for the `links` table : 
  156. #
  157.  
  158. DROP TABLE IF EXISTS `links`;
  159.  
  160. CREATE TABLE `links` (
  161.   `id_link` int(11) NOT NULL auto_increment,
  162.   `id_ficha` int(11) NOT NULL,
  163.   `descripcion` varchar(255) default NULL,
  164.   `direccion` varchar(255) default NULL,
  165.   PRIMARY KEY  (`id_link`,`id_ficha`),
  166.   UNIQUE KEY `id_link` (`id_link`)
  167. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  168.  
  169. #
  170. # Structure for the `operaciones` table : 
  171. #
  172.  
  173. DROP TABLE IF EXISTS `operaciones`;
  174.  
  175. CREATE TABLE `operaciones` (
  176.   `id_operacion` int(11) NOT NULL auto_increment,
  177.   `descripcion` int(11) default NULL,
  178.   PRIMARY KEY  (`id_operacion`)
  179. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  180.  
  181. #
  182. # Structure for the `permisos` table : 
  183. #
  184.  
  185. DROP TABLE IF EXISTS `permisos`;
  186.  
  187. CREATE TABLE `permisos` (
  188.   `id_permiso` int(11) NOT NULL auto_increment,
  189.   `descripcion` varchar(20) default NULL,
  190.   PRIMARY KEY  (`id_permiso`)
  191. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  192.  
  193. #
  194. # Structure for the `prestamos` table : 
  195. #
  196.  
  197. DROP TABLE IF EXISTS `prestamos`;
  198.  
  199. CREATE TABLE `prestamos` (
  200.   `id_prestamo` int(11) NOT NULL auto_increment,
  201.   `fecha_desde` date default NULL,
  202.   `fecha_hasta` date default NULL,
  203.   `id_usuario` int(11) default NULL,
  204.   `id_bibliotecaria` int(11) default NULL,
  205.   `id_libro` int(11) default NULL,
  206.   `fecha_devolucion` date default NULL,
  207.   PRIMARY KEY  (`id_prestamo`)
  208. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  209.  
  210. #
  211. # Structure for the `restricciones` table : 
  212. #
  213.  
  214. DROP TABLE IF EXISTS `restricciones`;
  215.  
  216. CREATE TABLE `restricciones` (
  217.   `id_restriccion` int(11) NOT NULL auto_increment,
  218.   `id_campo` int(11) NOT NULL,
  219.   `id_tabla` int(11) NOT NULL,
  220.   `id_operacion` int(11) default NULL,
  221.   `valor` varchar(255) default NULL,
  222.   PRIMARY KEY  (`id_restriccion`,`id_campo`,`id_tabla`)
  223. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  224.  
  225. #
  226. # Structure for the `roles` table : 
  227. #
  228.  
  229. DROP TABLE IF EXISTS `roles`;
  230.  
  231. CREATE TABLE `roles` (
  232.   `id_rol` int(11) NOT NULL auto_increment,
  233.   `descripcion` varchar(100) default NULL,
  234.   `fecha_creacion` date default NULL,
  235.   PRIMARY KEY  (`id_rol`)
  236. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  237.  
  238. #
  239. # Structure for the `roles_funciones` table : 
  240. #
  241.  
  242. DROP TABLE IF EXISTS `roles_funciones`;
  243.  
  244. CREATE TABLE `roles_funciones` (
  245.   `id_rol` int(11) NOT NULL,
  246.   `id_funcion` int(11) NOT NULL,
  247.   PRIMARY KEY  (`id_rol`,`id_funcion`)
  248. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  249.  
  250. #
  251. # Structure for the `roles_restricciones` table : 
  252. #
  253.  
  254. DROP TABLE IF EXISTS `roles_restricciones`;
  255.  
  256. CREATE TABLE `roles_restricciones` (
  257.   `id_rol` int(11) NOT NULL,
  258.   `id_restriccion` int(11) NOT NULL,
  259.   PRIMARY KEY  (`id_rol`,`id_restriccion`)
  260. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  261.  
  262. #
  263. # Structure for the `roles_usuarios` table : 
  264. #
  265.  
  266. DROP TABLE IF EXISTS `roles_usuarios`;
  267.  
  268. CREATE TABLE `roles_usuarios` (
  269.   `id_usuario` int(11) NOT NULL,
  270.   `id_rol` int(11) NOT NULL,
  271.   `fecha_creacion` date default NULL,
  272.   PRIMARY KEY  (`id_usuario`,`id_rol`)
  273. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  274.  
  275. #
  276. # Structure for the `subcategorias` table : 
  277. #
  278.  
  279. DROP TABLE IF EXISTS `subcategorias`;
  280.  
  281. CREATE TABLE `subcategorias` (
  282.   `id_subcategoria` int(11) NOT NULL auto_increment,
  283.   `descripcion` varchar(100) default NULL,
  284.   `fecha_alta` date default NULL,
  285.   PRIMARY KEY  (`id_subcategoria`)
  286. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  287.  
  288. #
  289. # Structure for the `tablas` table : 
  290. #
  291.  
  292. DROP TABLE IF EXISTS `tablas`;
  293.  
  294. CREATE TABLE `tablas` (
  295.   `id_tabla` int(11) NOT NULL auto_increment,
  296.   `nombre` varchar(100) default NULL,
  297.   `fecha_creacion` date default NULL,
  298.   PRIMARY KEY  (`id_tabla`)
  299. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  300.  
  301. #
  302. # Structure for the `tipo_material` table : 
  303. #
  304.  
  305. DROP TABLE IF EXISTS `tipo_material`;
  306.  
  307. CREATE TABLE `tipo_material` (
  308.   `id_tipo_material` int(11) NOT NULL auto_increment,
  309.   `decripcion` varchar(255) default NULL,
  310.   PRIMARY KEY  (`id_tipo_material`)
  311. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  312.  
  313. #
  314. # Structure for the `ubicaciones` table : 
  315. #
  316.  
  317. DROP TABLE IF EXISTS `ubicaciones`;
  318.  
  319. CREATE TABLE `ubicaciones` (
  320.   `id_ubicacion` int(11) NOT NULL auto_increment,
  321.   `descripcion` varchar(20) default NULL,
  322.   `titulo` varchar(255) default NULL,
  323.   PRIMARY KEY  (`id_ubicacion`)
  324. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  325.  
  326. #
  327. # Structure for the `usuarios` table : 
  328. #
  329.  
  330. DROP TABLE IF EXISTS `usuarios`;
  331.  
  332. CREATE TABLE `usuarios` (
  333.   `id_usuario` int(11) NOT NULL auto_increment,
  334.   `nombre` varchar(255) default NULL,
  335.   `apellido` varchar(255) default NULL,
  336.   `dni` varchar(10) default NULL,
  337.   `matricula` varchar(10) default NULL,
  338.   `fecha_nacimiento` date default NULL,
  339.   `domicilio_calle` varchar(255) default NULL,
  340.   `domicilio_piso` varchar(10) default NULL,
  341.   `domicilio_nro` varchar(10) default NULL,
  342.   `domicilio_cod_postal` varchar(12) default NULL,
  343.   `tel1` varchar(16) default NULL,
  344.   `tel2` varchar(16) default NULL,
  345.   `fecha_baja` date default NULL,
  346.   PRIMARY KEY  (`id_usuario`)
  347. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  348.  
  349.